package cn.gzy.controller;

import cn.gzy.pojo.Attention;
import cn.gzy.service.AttentionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/attention")
public class AttentionController {

    @Autowired
    private AttentionService attentionService;

    @PostMapping("/add")
    public ResponseEntity<Integer> addAttention(@RequestBody Attention attention) {
        Integer result = attentionService.insertAttention(attention);
        if (result > 0) {
            return new ResponseEntity<>(result, HttpStatus.CREATED);
        } else {
            return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
        }
    }
}